#include <qvccontex.h>
#include <QTimer>
#include <QDebug>

int main(int argc, char *argv[])
{
    QVCContex a(argc, argv);
    a.setTransfer(std::make_unique<ShareMemoryTransfer>());

    struct MEM {
        int a = 100;
        int b = 20;
        int c = 50;
    };

    QTimer timer;
    QObject::connect(&timer, &QTimer::timeout, [&a]{
        static int a_1 = 0, b_1 = 0, c_1 = 0;
        MEM test{a_1++, b_1++, c_1++};
        a.publish("/123", test);

        a.publish("/456", test);

        a.publish("/789", test);

        a.publish("/1023", test);
    });

    timer.start(10);


//    a.subscribe<MEM>("/123", [](const MEM& val) {
//        qDebug()<<val.a << val.b << val.c;
//    });
    
    return a.exec();
}
